Skip to content

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Sep 20, 2025

Merge _WindowsPathInfo and _PosixPathInfo classes into a new StatResultInfo class. On Windows, this means relying on os.stat() rather than os.path.isfile() and friends, which is a little slower. But there's value in making the code easier to maintain, and we're going to need the stat result for implementing size(), mode() etc.

Merge `_WindowsPathInfo` and `_PosixPathInfo` classes into a new
`StatResultInfo` class. On Windows, this means relying on `os.stat()`
rather than `os.path.isfile()` and friends, which is a little slower. But
there's value in making the code easier to maintain, and we're going to
need the stat result for implementing `size()`, `mode()` etc.
@barneygale
Copy link
Contributor Author

We'll hit a circular import problem when we try to add a Mode enum in #139183, which arises because the local path info classes belong in pathlib, not pathlib._os. Once this PR is approved I'll push another commit that moves the classes and copy_info(), but I'll hold off for now as it'd obscure the diff.

@barneygale barneygale enabled auto-merge (squash) September 24, 2025 00:44
@barneygale barneygale merged commit 9e64938 into python:main Sep 24, 2025
79 of 81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant